import java.util.Scanner;

public class Main {
    public static int ack(int n,int m){
        if(m==0){
            return n+1;
        }else if(n==0 && m>0){
            return ack(1,m-1);
        }
            return ack(ack(n-1,m),m-1);
    }

    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        int n = num.nextInt();
        int m = num.nextInt();
        System.out.println(ack(n, m));
    }
}
